﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GGSharp.Radio
{
    public class StreamResponse : RDSResponseBase
    {
        private string _streamServer;
        private string _password;

        public StreamResponse(RequestInfo request)
        {
            this.Request = request;
            this.Type = ResponseType.Stream;
        }

        public string Password
        {
            get { return _password; }
            protected set
            {
                _password = value;
                OnPropertyChanged("Password");
            }
        }

        public string StreamServer
        {
            get { return _streamServer; }
            set
            {
                _streamServer = value;
                OnPropertyChanged("StreamServer");
            }
        }

        public string StreamAddress
        {
            get { return String.Format("http://{0}:{1}@{2}", Request.Number, Password, StreamServer); }
        }

        public override void Read(string response)
        {
            //1;gr-grr-13.gaduradio.pl:80/33;Z1Hd4jUxbE;Dodaj do kontaktow nr 431 i wejdz na www.mamma-mia.com.pl;;
            string[] values = response.Split(';');
            this.StreamServer = values[1];
            this.Password = values[2];
            this.RDSText = values[3];
        }
    }
}
